import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class Demo07 {
    public static void main(String[] args) {
    new MyFrame();
    }
}
class MyFrame implements ActionListener {
      Frame F =  new Frame();
      Button B =   new Button("开始游戏");
      public MyFrame(){
          F.setSize(500,500);
          F.setTitle("安梓嘉专属小球");
          F.add(B);
          F.setLayout(new FlowLayout());
          B.addActionListener(this);
          F.setVisible(true);
      }


    @Override
    public void actionPerformed(ActionEvent e) {
            F.setBackground(Color.RED);
    }
}
